package studio.raptor.databus.command;

import java.util.HashMap;

/**
 * Created on 2017/8/15  <br>
 *
 * @author koalton
 */
public class MessagePropertyBuilder {
  MessageProperty messageProperty ;
  public MessagePropertyBuilder(){
    messageProperty = new MessageProperty();
  }

  /**
   * 增加字符串属性
   * @param name 属性名称
   * @param value 属性值
   */
  public void addStringProperty(String name,String value){
    if( messageProperty.getStringProperty() == null ){
      messageProperty.setStringProperty(new HashMap<String, String>());
    }
    messageProperty.getStringProperty().put(name,value);
  }

  /**
   * 增加整型类型属性
   * @param name 属性清楚
   * @param value 属性值
   */
  public void addIntProperty(String name,Integer value){
    if( messageProperty.getIntProperty() == null ){
      messageProperty.setIntProperty(new HashMap<String, Integer>());
    }
    messageProperty.getIntProperty().put(name,value);
  }

  /**
   * 增加长整型类型属性
   * @param name 属性名称
   * @param value 属性值
   */
  public void addLongProperty(String name,Long value){
    if( messageProperty.getLongProperty() == null ){
      messageProperty.setLongProperty(new HashMap<String, Long>());
    }
    messageProperty.getLongProperty().put(name,value);
  }

  public MessageProperty build(){
    return messageProperty ;
  }


}
